package com.redsoil.house.model.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * Created by weidingqiang on 2019/1/7.
 */

public class ProductDetailVO implements Parcelable{

    /**
     * originalPrice : 100
     * intro : 商品简介
     * pubTime :
     * name : 你好
     * currentPrice : 80
     * stockQuantity : 6
     * dpic : [{"id":"1","pic":"a/a.png"},{"id":"2","pic":"a/b.png"}]
     * id : 4d5548a47595426eb9e29205b8027e88
     * pic : product/06ec87ecc5384e35b15178cfee6f159fjpg
     */

    private int originalPrice;
    private String intro;
    private String pubTime;
    private String name;
    private int currentPrice;
    private int stockQuantity;
    private String id;
    private String pic;
    private List<DpicBean> dpic;

    public int getOriginalPrice() {
        return originalPrice;
    }

    public void setOriginalPrice(int originalPrice) {
        this.originalPrice = originalPrice;
    }

    public String getIntro() {
        return intro;
    }

    public void setIntro(String intro) {
        this.intro = intro;
    }

    public String getPubTime() {
        return pubTime;
    }

    public void setPubTime(String pubTime) {
        this.pubTime = pubTime;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getCurrentPrice() {
        return currentPrice;
    }

    public void setCurrentPrice(int currentPrice) {
        this.currentPrice = currentPrice;
    }

    public int getStockQuantity() {
        return stockQuantity;
    }

    public void setStockQuantity(int stockQuantity) {
        this.stockQuantity = stockQuantity;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getPic() {
        return pic;
    }

    public void setPic(String pic) {
        this.pic = pic;
    }

    public List<DpicBean> getDpic() {
        return dpic;
    }

    public void setDpic(List<DpicBean> dpic) {
        this.dpic = dpic;
    }

    public static class DpicBean implements Parcelable{
        /**
         * id : 1
         * pic : a/a.png
         */

        private String id;
        private String pic;

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getPic() {
            return pic;
        }

        public void setPic(String pic) {
            this.pic = pic;
        }


        @Override
        public int describeContents() {
            return 0;
        }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.id);
            dest.writeString(this.pic);
        }

        public DpicBean() {
        }

        protected DpicBean(Parcel in) {
            this.id = in.readString();
            this.pic = in.readString();
        }

        public static final Creator<DpicBean> CREATOR = new Creator<DpicBean>() {
            @Override
            public DpicBean createFromParcel(Parcel source) {
                return new DpicBean(source);
            }

            @Override
            public DpicBean[] newArray(int size) {
                return new DpicBean[size];
            }
        };
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.originalPrice);
        dest.writeString(this.intro);
        dest.writeString(this.pubTime);
        dest.writeString(this.name);
        dest.writeInt(this.currentPrice);
        dest.writeInt(this.stockQuantity);
        dest.writeString(this.id);
        dest.writeString(this.pic);
        dest.writeTypedList(this.dpic);
    }

    public ProductDetailVO() {
    }

    protected ProductDetailVO(Parcel in) {
        this.originalPrice = in.readInt();
        this.intro = in.readString();
        this.pubTime = in.readString();
        this.name = in.readString();
        this.currentPrice = in.readInt();
        this.stockQuantity = in.readInt();
        this.id = in.readString();
        this.pic = in.readString();
        this.dpic = in.createTypedArrayList(DpicBean.CREATOR);
    }

    public static final Creator<ProductDetailVO> CREATOR = new Creator<ProductDetailVO>() {
        @Override
        public ProductDetailVO createFromParcel(Parcel source) {
            return new ProductDetailVO(source);
        }

        @Override
        public ProductDetailVO[] newArray(int size) {
            return new ProductDetailVO[size];
        }
    };
}
